package web.dmt.dao.proxy;
import web.dmt.dao.CorporationDAO;
import web.dmt.dao.impl.CorporationDAOImpl;
import web.dmt.dbc.DatebaseConnection;
import web.dmt.vo.Corporation;

public class CorporationProxy implements CorporationDAO{
	private DatebaseConnection dbc;
	private CorporationDAO dao;
	public CorporationProxy(){
		this.dbc=new DatebaseConnection();
		this.dao=new CorporationDAOImpl(this.dbc.getConnection());
	}
	public boolean doCreate(Corporation corporation) throws Exception {
		boolean flag=false;
		try{
			flag=this.dao.doCreate(corporation);
		}catch(Exception e){
			throw e;
		}finally{
			this.dbc.close();
		}
		return flag;
	}
	public boolean doUpdate(Corporation corporation)throws Exception {
		boolean flag=false;
		try{
			flag=this.dao.doCreate(corporation);
		}catch(Exception e){
			throw e;
		}finally{
			this.dbc.close();
		}
		return flag;
	}
	public Corporation findById(Integer cid)throws Exception {
		Corporation corporation=null;
		try{
			corporation=this.dao.findById(cid);
		}catch(Exception e){
			throw e;
		}finally{
			this.dbc.close();
		}
		return corporation;
	}
	public boolean doUpdate1(Corporation corporation) throws Exception{
		boolean flag=false;
		try{
			flag=this.dao.doCreate(corporation);
		}catch(Exception e){
			throw e;
		}finally{
			this.dbc.close();
		}
		return flag;
	}
	public boolean doUpdate2(Corporation corporation)throws Exception {
		boolean flag=false;
		try{
			flag=this.dao.doCreate(corporation);
		}catch(Exception e){
			throw e;
		}finally{
			this.dbc.close();
		}
		return flag;

	}
	
}
